<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-userElevatorAllot-add">
			<div class="form-group">
				<label class="col-sm-3 control-label">分配电梯：</label>
				<div class="col-sm-8">
					<label th:each="elevator:${elevatorInfoList}" class="check-box">
						<input name="elevator" type="checkbox" th:value="${elevator.elevatorId}" th:text="${elevator.elevatorName}" th:checked="${elevator.offChecked} == true">
					</label>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "business/userElevatorAllot"
		$("#form-userElevatorAllot-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
                var userId = [[${userId}]];
                var elevators = $.form.selectCheckeds("elevator");
                $.ajax({
                    cache : true,
                    type : "POST",
                    url : prefix + "/add",
                    data : {
                        "userId": userId,
                        "elevators": elevators,
                    },
                    async : false,
                    error : function(request) {
                        $.modal.alertError("系统错误");
                    },
                    success : function(data) {
                        $.operate.successCallback(data);
                    }
                });
	        }
	    }
	</script>
</body>
</html>
